#ifndef TOOLS_RANDOM_H
#define TOOLS_RANDOM_H

#include <algorithm>
#include <random>
#include <stdexcept>
#include <iostream>
#include "Global.h"

namespace Tool
{
class ExportAPI Random
{
public:
    Random();
    ~Random();
    int GetInt(int min, int max);
    double GetDouble(double min, double max);
    bool GetBool();
    double GetNormal(double mean, double stddev);

    template <typename Container>
    typename Container::value_type Choose(const Container& container)
    {
        if (container.empty())
        {
            std::cerr << "Container is empty" << std::endl;
        }
        std::uniform_int_distribution<size_t> dis(0, container.size() - 1);
        return container[dis(gen)];
    }

    template <typename Container>
    void Shuffle(Container& container)
    {
        std::shuffle(container.begin(), container.end(), gen);
    }
private:
    std::random_device rd;
    std::mt19937 gen;
};
}
#endif // RANDOM_H
